package com.wh.hotel.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author luweije
 */

@Getter
@AllArgsConstructor
public enum YesNoEnum {

    YES(1, "正常"),
    NO(2, "不正常"),
    ;

    private final int code;
    private final String desc;

    public static YesNoEnum parse(Integer code) {
        if (code == null) {
            return null;
        }
        for (YesNoEnum yesNoEnum : YesNoEnum.values()) {
            if (yesNoEnum.getCode() == code) {
                return yesNoEnum;
            }
        }
        return null;
    }

}
